package com.xq.shop.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.xq.shop.dao.IAdminDAO;
import com.xq.shop.po.Admin;
import com.xq.shop.util.HibernateUtil;

@Repository
@SuppressWarnings("unchecked")
public class AdminDAO extends BaseDAO<Admin> implements IAdminDAO {

	@Override
	public Admin get(Admin user){
		List<Admin> list = HibernateUtil.getTemplate().findByExample(user);
		if(list != null && list.size() > 0){
			return list.get(0);
		} else {
			return null;
		}
	}

	@Override
	public List<Admin> get(String username) {
		return HibernateUtil.getTemplate().find(" from Admin where username=?", username);
	}
}
